package com.zh.entity.advanced.entity;

import com.zh.entity.advanced.valid.SexValid;
import lombok.Data;

import javax.validation.constraints.*;
import java.math.BigDecimal;

@Data
public class DemoValidEntity {

    @NotNull(message = "不能为Null")
    @PositiveOrZero(message = "元素必须是正数或0")
    private Integer paramInt;

    @NotNull(message = "不能为Null")
    @NotBlank(message = "不能为空字符串")
    @Pattern(regexp = "^[a-zA-Z]$", message = "第一个字符必须是字母")
    private String paramStr;

    @Max(value = 1000, message = "最大值是1000")
    private BigDecimal paramBb;

    @NotNull(message = "不能为Null")
    @SexValid(val = {1, 2}, message = "只能输入1或2；1=男，2=女")//自定义校验规则
    private byte paramB;
}
